var caiwuTable = {
		render:function(colName,text,indexStr,mItem){
			switch(colName){
			case 'dkStatusZw':
				var tex = $('#repayRecordQueryFrm select[name="dkStatus"]')
					.find('option[value="'+text+'"]').text();
				return tex;
			}
		}
};

function caiwuState(){
	$('#repayRecordQueryFrm select[name="dkStatus"]')
		.find('option').each(function(){
			var value = $(this).attr('value');
			switch(value){
			case '':
				break;
			case '038001':
				break;
			case '038002':
				break;
			case '038003':
				break;
			default:
				$(this).remove();
			}
		});
	$('#repayRecordQueryFrm select[name="dkStatus"]').val('038002');
	queryRepayRecordListAjax.send();
}

function caiwuConditionExport(){
//	var _data = $('#repayRecordQueryFrm').serializeObject();
//	exportExcelAjax.setData(_data);
	MsgBox.confirm("确认导出","导出确认",function(){
		exportExcelAjax.send();
	});
}
function caiwuExportAll(){
	exportExcelAjax.send();
}
function onDoubleClick(){
	var currRecord = RepayRecordTable.getCurrentRecord();
	if(currRecord.data.dkStatus =="038002"){
//		var url = ctx + "/sms/queryRepayRecord/caiwuRepayRecordDatil/" + currRecord.data.pubrepayId +"/"+currRecord.data.customerName +"/"+currRecord.data.chanName;
//		MsgBox.open('financeDialog', '对公正常还款', url, "800px");
		unnormalAmtAjax.setUrl(ctx+"/sms/register/hasOtherAmt/"+currRecord.data.loanNo);
		unnormalAmtAjax.send();
	}else{
		new $.zui.Messager('只能操作未还状态的数据!', {
		    type: 'success',
		    time: 2000,
		    placement:'center'
		}).show();
	}
}
function onFinanceExportAllSucc(){
	if(data.success == true){
		window.open("sms/queryRepayRecord/exportFinanceExcel");
	}else{
	new $.zui.Messager('导出失败！数据为空!', {
		type: 'success',
		time: 2000,
		placement:'center'
	}).show();
	}
}
function onFinanceExportSucc(data){
	if(data.success == true){
		var loanNo = $("#loanNo").val();
		var customerName = $("#customerName").val();
		var dkStatus = $("#dkStatus").val();
		var startDate = $("#startDate").val();
		var endDate = $("#endDate").val();
		window.open("sms/queryRepayRecord/exportFinanceExcel?loanNo="+loanNo+"&customerName="+customerName+"&dkStatus="+dkStatus+"&startDate="+startDate+"&endDate="+endDate);
	}else{
		new $.zui.Messager('导出失败！数据为空!', {
			type: 'success',
			time: 2000,
			placement:'center'
		}).show();
	}
}

function unrecordSucc(data){//未入账记录成功
	var currRecord = RepayRecordTable.getCurrentRecord();
	console.log(currRecord);
	console.log(data);
	if(data.success == true){
		if(data.info.data && data.info.data.length == 0){//没有未入账信息
			var url = ctx + "/sms/queryRepayRecord/caiwuRepayRecordDatil/" + currRecord.data.pubrepayId +"/"+currRecord.data.customerName +"/"+currRecord.data.chanName;
			MsgBox.open('financeDialog', '对公正常还款', url, "800px");
		}else{//有未入账信息
			var loanNo = currRecord.data.loanNo;
			var url =  ctx+"/sms/pcl/unrecorded/"+loanNo;
			MsgBox.open("unrecorded", "未入账记录", url, "700", "sm","book","ajax");
		}
	}else{
		$('#hasUnrecorded').val('');
	}
}
//有未入账记录
function unnormalAjaxSucc(re){
	var currRecord = RepayRecordTable.getCurrentRecord();
	if(re.success == true){
		var data = re.info;
		var total = data.totalAmt;
		var unrecordAmt = data.unrecordAmt || 0;
		var hasSubmit = data.hasSubmit || 0;
		var loanNo = currRecord.data.loanNo;
		var mthDay = currRecord.data.repayMthDay;
		if(total != null && parseFloat(total).toFixed(2) > 0){//有异常金额记录
			var url = ctx + "/sms/register/caiwuAmtJuge/"+loanNo+"/"+mthDay+"/"+
					unrecordAmt+"/"+hasSubmit+"/"+total;
			MsgBox.open("unnormalAmt", "金额异常提示", url, "600", "sm","book","ajax");
		}else{
			var url = ctx + "/sms/queryRepayRecord/caiwuRepayRecordDatil/" + currRecord.data.pubrepayId +"/"+currRecord.data.customerName +"/"+currRecord.data.chanName;
			MsgBox.open('financeDialog', '对公正常还款', url, "800px");
		}
	}
}

function open(){
	var currRecord = RepayRecordTable.getCurrentRecord();
	var url = ctx + "/sms/queryRepayRecord/caiwuRepayRecordDatil/" + currRecord.data.pubrepayId +"/"+currRecord.data.customerName +"/"+currRecord.data.chanName;
	MsgBox.open('financeDialog', '对公正常还款', url, "800px");
}